package com.autumn.sms.configure;

import java.io.Serializable;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 短信属性
 * 
 * @author 杨昌国 2018-12-07 23:58:35
 */
@ConfigurationProperties(prefix = AutumnSmsProperties.PREFIX)
public class AutumnSmsProperties implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6200443879549297812L;

	/**
	 * 属性前缀
	 */
	public final static String PREFIX = "autumn.sms.channel";

	private AliyunSmsProperties aliyun;
	private TencentSmsProperties tencent;

	/**
	 * 
	 */
	public AutumnSmsProperties() {
		this.setAliyun(new AliyunSmsProperties());
		this.setTencent(new TencentSmsProperties());
	}

	/**
	 * 获取阿里云属性
	 * 
	 * @return
	 */
	public AliyunSmsProperties getAliyun() {
		return aliyun;
	}

	/**
	 * 设置阿里云属性
	 * 
	 * @param aliyun
	 *            阿里云属性
	 */
	public void setAliyun(AliyunSmsProperties aliyun) {
		this.aliyun = aliyun;
	}

	/**
	 * 获取腾讯云属性
	 * 
	 * @return
	 */
	public TencentSmsProperties getTencent() {
		return tencent;
	}

	/**
	 * 设置腾讯云属性
	 * 
	 * @param tencent
	 *            腾讯云属性
	 */
	public void setTencent(TencentSmsProperties tencent) {
		this.tencent = tencent;
	}

	/**
	 * 短信通道属性抽象
	 * 
	 * @author 杨昌国 2018-12-08 00:07:27
	 */
	public abstract class AbstractSmsChannelProperties implements Serializable {

		/**
		 * 
		 */
		private static final long serialVersionUID = -3319754143472592275L;
		private boolean enable = false;

		/**
		 * 获取是否启用
		 * 
		 * @return
		 */
		public boolean isEnable() {
			return enable;
		}

		/**
		 * 设置是否启用
		 * 
		 * @param enable
		 *            是否启用
		 */
		public void setEnable(boolean enable) {
			this.enable = enable;
		}

	}

	/**
	 * 阿里云短信通道属性
	 * 
	 * @author 杨昌国 2018-12-08 00:11:21
	 */
	public class AliyunSmsProperties extends AbstractSmsChannelProperties {

		/**
		 * 
		 */
		private static final long serialVersionUID = 5153680225246667043L;

		/**
		 * bean条件属性
		 */
		public static final String BEAN_CONDITIONAL_PROPERTY = AutumnSmsProperties.PREFIX + ".aliyun.enable";

		private String accessKeyId;
		private String accessKeySecret;
		private String defaultSignName;

		/**
		 * 获取访问键id
		 * 
		 * @return
		 */
		public String getAccessKeyId() {
			return accessKeyId;
		}

		/**
		 * 设置访问键id
		 * 
		 * @param accessKeyId
		 *            访问键id
		 */
		public void setAccessKeyId(String accessKeyId) {
			this.accessKeyId = accessKeyId;
		}

		/**
		 * 获取访问密钥
		 * 
		 * @return
		 */
		public String getAccessKeySecret() {
			return accessKeySecret;
		}

		/**
		 * 设置访问密钥
		 * 
		 * @param accessKeySecret
		 */
		public void setAccessKeySecret(String accessKeySecret) {
			this.accessKeySecret = accessKeySecret;
		}

		/**
		 * 获取默认签名
		 * 
		 * @return
		 */
		public String getDefaultSignName() {
			return defaultSignName;
		}

		/**
		 * 设置默认签名
		 * 
		 * @param defaultSignName
		 */
		public void setDefaultSignName(String defaultSignName) {
			this.defaultSignName = defaultSignName;
		}
	}

	/**
	 * 腾讯云短信通道属性
	 * 
	 * @author 杨昌国 2018-12-08 00:15:07
	 */
	public class TencentSmsProperties extends AbstractSmsChannelProperties {

		/**
		 * 
		 */
		private static final long serialVersionUID = -1202214641719812345L;

		/**
		 * Bean条件属性
		 */
		public static final String BEAN_CONDITIONAL_PROPERTY = AutumnSmsProperties.PREFIX + ".tencent.enable";

		private Integer appId;
		private String appKey;

		/**
		 * 获取应用id
		 * 
		 * @return
		 */
		public Integer getAppId() {
			return appId;
		}

		/**
		 * 设置应用id
		 * 
		 * @param appid
		 */
		public void setAppid(Integer appId) {
			this.appId = appId;
		}

		/**
		 * 获取应用Key
		 * 
		 * @return
		 */
		public String getAppKey() {
			return appKey;
		}

		/**
		 * 设置应用Key
		 * 
		 * @param appKey
		 */
		public void setAppkey(String appKey) {
			this.appKey = appKey;
		}

	}
}
